/*
 * @Author: your name
 * @Date: 2022-04-16 13:29:14
 * @LastEditTime: 2022-07-19 02:04:07
 * @LastEditors: YNT 2501512800@qq.com
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \22-03-19 智慧社区\api\score.js
 */
import wxRequest from '../utils/wx-request'

class SpecialModel extends wxRequest {
  // 查看积分
  checkScore() {
    return this.request({
      url: `/api/v1/balance`,
      method: 'GET',
    })
  }

  // 商品分类
  goodType() {
    return this.request({
      url: `/api/v1/goods/type`,
      method: 'GET',
    })
  }

  // 商品列表
  goodsList(id, params) {
    return this.request({
      url: `/api/v1/goods/list?goods_type_id=${id}`,
      method: 'GET',
      params,
    })
  }

  // 购买商品
  purchaseGood(params) {
    return this.request({
      url: `/api/v1/goods_order`,
      method: 'POST',
      params,
    })
  }

  // 兑换记录
  recordList() {
    return this.request({
      url: `/api/v1/goods_order/list`,
      method: 'GET',
    })
  }

  // 排行榜
  rankList() {
    return this.request({
      url: `/api/v1/balance/ranking_list`,
      method: 'GET',
    })
  }
}

export default new SpecialModel()
